# package require md5

proc print {name} {
	global arr

	set name "[pwd]/$name"

	if { [info exists arr($name)] } {
		return
	}
	set arr($name) ""

	puts "// $name {"
	set f [open $name "r"]
	foreach line [split [read $f] "\n"] {
		if { [regexp {^#include\s*"(.*/)?([^/"]*)"} $line match dir file] } {
			if { $dir != "" } { 
				set path $dir
				set dir [pwd]
				cd $path
			}

			print $file

			if { $dir != "" } {
				cd $dir
			}
		} else {
			puts $line
		}
	}
	close $f
	puts "// } $name"
}

print "test0.cpp"
